package com.hqd.jjvm.classformat.constantpool;

import com.hqd.jjvm.classformat.ClassFile;
import com.hqd.jjvm.util.HexStrTransformUtil;
import lombok.Getter;

/**
 * 浮点型常量池
 */
@Getter
public class ConstantFloatInfo extends ConstantPool {
	private Float bytes;

	public ConstantFloatInfo(ConstantInfoType tag, ClassFile classFile) {
		super(tag, classFile);
		this.bytes = Float.intBitsToFloat(HexStrTransformUtil.parseHexToInt(classFile.readU4()));
	}

	@Override
	public Float getVal() {
		return bytes;
	}
}
